﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using System.Web;

namespace Mytrip.Localization.Controllers
{
    [HandleError]
    [Localization]
    public class LanguageController:Controller
    {
        public ActionResult Index(string id,string id2)
        {
            Session["culture"] = id;
            HttpCookie myCookie = new HttpCookie("myTripCulture", id);
            myCookie.Expires = DateTime.Now.AddMonths(12);
            if (Response.Cookies["myCookie"] == null)
                Response.Cookies.Add(myCookie);
            else
            {
                Response.Cookies.Remove("myCookie");
                Response.Cookies.Add(myCookie);
            }
            id2 = id2.Replace("(x)", "/");
            return Redirect(id2);
        }
    }
}
